package com.ssy.lingxi.member.merchant.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 会员服务 - 字符串枚举 - 用于国际化支持
 * @author wyx
 * @version 2.0.0
 * @date 2022-02-28
 **/
public enum MerchantMemberStringEnum {
    STR_1(1, "订单号:");

    private final Integer code;
    private final String message;

    MerchantMemberStringEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getDeclaringClass(), this.getCode());
    }

    public static String getMessage(Integer code) {
        MerchantMemberStringEnum item = Arrays.stream(MerchantMemberStringEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        return null != item ? item.getMessage() : "";
    }
}
